<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>注册</title>
<meta name="Keywords" content="www.021news.cn">
<meta name="Description" content="www.021news.cn">

<!-- Bootstrap -->
<link href="/public/images/bootstrap.min.css" rel="stylesheet">
<link href="/public/images/main.css" rel="stylesheet">
<link href="/public/images/enter.css" rel="stylesheet">
<script src="/public/images/jquery.min.js"></script>
<script src="/public/images/bootstrap.min.js"></script>
<script src="/public/images/jquery.particleground.min.js"></script>
</head>
<body>
<div id="particles">
  <canvas class="pg-canvas" width="1920" height="911" style="display: block;"></canvas>
  <div class="intro" style="margin-top: -256.5px;">
    <div class="container">
      <div class="row" style="padding:30px 0;">
        <div class="col-md-3 col-centered tac"> <img src="/public/images/logo.png" alt="logo"> </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-md-3 col-sm-8 col-centered">
             <div class="form-group">
              <input type="text" name='nickname' class="form-control" id="n" name="account" placeholder="账号" autocomplete="off" aria-required="true" data-tip="英文字母数字或下划线">
            </div>
            <div class="form-group">
              <input type="password" name="pass" class="form-control" id="p" name="password" placeholder="密码" aria-required="true" data-tip="请设置您的密码（6-16个字符）">
            </div>
            <div class="form-group">
              <input type="password" name="pass2" class="form-control" id="p2" name="repeat_password" placeholder="再次输入密码" aria-required="true" data-tip="请再输入一次密码">
            </div>
            
            <div class="form-group">
              <input type="number" name="pass" class="form-control" id="yzm" name="yzm" placeholder="请输入验证码" style="width: 130px;float: left;"> <img  style="width: 140px;" onclick="this.src='/?G=Index/hcode&'+Math.random()" src="/?G=Index/hcode" />
            </div>
            
            <div id="validator-tips" class="validator-tips"></div>
            <div class="checkbox">
              <label>
                <input type="checkbox" checked="checked" name="ag">  同意 </label>
              <a href="javascript:void(0)" id="userAgreement" style="text-decoration:none">用户协议</a> </div>
            <div class="form-center-button">
              <button type="submit" id="submit_button" class="btn btn-primary btn-current">注册</button>
              <a href="/?G=Index/log" class="btn btn-default">登录</a> </div>
         
        </div>
      </div>
    </div>
    <div class="modal fade" id="myModal" tabindex="-1" style="text-align: left" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button>
            <h4 class="modal-title">用户协议</h4>
          </div>
          <div class="modal-body" id="agreementContent"></div>
        </div>
      </div>
    </div>
    <link rel="stylesheet" href="/public/images/jquery.validator.css">
  
  </div>
</div>
<script>
    $(document).ready(function () {
        var intro = $('.intro');
        $('#particles').particleground({
            dotColor: 'rgba(52, 152, 219, 0.36)',
            lineColor: 'rgba(52, 152, 219, 0.86)',
            density: 130000,
            proximity: 500,
            lineWidth: 0.2
        });
        intro.css({
            'margin-top': -(intro.height() / 2 + 100)
        });


		$("#submit_button").click(function(){

			var n=$("#n").val();
			var p=$("#p").val();
			var p2=$("#p2").val();
			var yzm=$("#yzm").val();
			if(p!=p2 || (p=='' || p2=='')){
				alert(' 密码不一致或密码为空');
				return;
			}

			if(yzm=='' || n=='' || p==''){
				alert('信息为空');
				return;
			}
			if(p.length<6){
				alert('密码必须大于6位数');
				return;
			}
			if(n.length<6){
				alert('账号必须大于6位数');
				return;
			}
			if(yzm==''){
				alert('验证码为空');
				return;
			}	

			$.ajax({
		         type: "POST",
		         url: "/?G=Index/rsg",
		         data:  {"n":n,'p':p,'yzm':yzm},
		         success:function(data){
		            	if(data=='y'){
			            	location="/?G=Index/login";
		            	}else{
							alert(data);
			            }
		         }
			});
		});
        
    });
</script>

</body>
</html>